package com.saltedfish.tool.dialog;

import android.app.Activity;
import android.view.Gravity;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.saltedfish.tool.R;

import butterknife.BindView;
import cn.droidlover.xdroidmvp.popwindow.DialogHelper;
import cn.droidlover.xdroidmvp.util.ToastUtils;

public class UILoginDialog extends DialogHelper {

    @BindView(R.id.checkbox)
    ImageView checkbox;
    @BindView(R.id.tv_user_service)
    TextView tv_user_service;
    @BindView(R.id.tv_user_sercret)
    TextView tv_user_sercret;
    @BindView(R.id.selectCheckbox)
    RelativeLayout selectCheckbox;
    @BindView(R.id.wx_login)
    LinearLayout wx_login;

    public UILoginDialog(Activity context) {
        super(context, R.style.AlertDialogStyle);
        this.mContext = context;
        setFullWidthScreen();
        setGravity(Gravity.BOTTOM);
        setAnimSet(R.style.popBottomPopAnim);

    }

    @Override
    protected int getLayoutId() {
        return R.layout.dialog_ui_login;
    }

    private boolean isShow  = true ;

    @Override
    protected void initView() {
        selectCheckbox.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if(isShow){
                    isShow = false;
                    checkbox.setImageResource(R.drawable.loading_button_unselecte);
                }else{
                    isShow = true;
                    checkbox.setImageResource(R.drawable.loading_button_selected);
                }
            }
        });

        wx_login.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (listener != null && isShow) {
                    listener.onClick("wxLogin");
                }else{
                    ToastUtils.showMessageBottom(mContext,"请阅读并同意相关政策");
                }
                // dismiss();
            }
        });


        tv_user_service.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (listener != null) {
                    listener.onClick("userService");
                }
               // dismiss();
            }
        });

        tv_user_sercret.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (listener != null) {
                    listener.onClick("userSecret");
                }
              //  dismiss();
            }
        });


    }

    @Override
    protected void initData() {

    }

    @Override
    protected void dialogDismiss() {

    }


}
